public class ReadOnlyTextBox : TextBox {
[DllImport("user32.dll")] static extern bool HideCaret(IntPtr hWnd); public ReadOnlyTextBox() { this.ReadOnly = true; this.BackColor = Color.White; this.GotFocus += TextBoxGotFocus; this.Cursor = Cursors.Arrow; // mouse cursor like in other controls } private void TextBoxGotFocus(object sender, EventArgs args) {
HideCaret(this.Handle); } }
Liked By
Write Answer
C# How to Disable Cursor in Textbox?
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy
Join MindStick Community
You have need login or register for voting of answers or question.
Pravesh Singh
14-Nov-2013